/**
 * 封装 axios 请求模块
 */
import axios from "axios"
import store from '@/store'
// https://java.yuanfuda933.com/prod-api/ 正式地址
// http://39.101.197.38:8080 测试地址
// http://39.103.177.253:8080 更新测试版

const http = axios.create({
    baseURL: 'http://39.103.177.253:8080' // 基础路径
})

// 请求拦截器
http.interceptors.request.use(config => {
    const versions = "7";
    const tokens = "wrEwAI3bXPPIn5pbNxq17p4UBqRwPqeaGpWCXSyEP/iLUtUVbyTh4Oez2F8YLDSn";
    const dids = "00000000-1131-3511-ffff-ffffca01fdf4";
    const types = "android";
    const signs = "QgS+tSHaB26bSj8bH9ZdIddShuRmZ6CgIlrqpspc/FRR4++H/OuNDZWzu568+BkqvlBE+rcXCVqnWH66Mcn0V3YXpuah8vQlz9qGS2SKzbrx62yzbagcoV7wz1Jzd49uXpt7sMwu0zw4H8tDmgisXeEkkNJf/TwkFLHlHIjwY8YwLCIBqJlEcVR/Ak/1sKxNj1vv3hhgLSM+uwDna5XmEipVBAUBe+NdaXZ7GHHjai22z/YbXRprDhbI6TriZCGlkTHK2NPMY3k1gZqL+v/FgCUYoleNV9QpnBPyM6x5FB4oYgCudvJ0UwjsMrSEemcM";
    const times = "1629421786608";
    const models = "Redmi K20 Pro";
    // const { gettoken } = store.state
    // console.log(gettoken);
    config.headers = {
        version: versions,
        token: tokens,
        did: dids,
        type: types,
        sign: signs,
        time: times,
        model: models,
    }
    // 在最后必须 return config
    return config
})
export default http